@extends('layouts.buz.layout', ['header_active' => 'settle'])
@section('title')
    提现列表
@endsection()
@section('full-content')

    @include('layouts.buz.sidebar.remit', ['active' => 'withdrawList'])

    <div class="yhy-member col-sm-9 col-sm-push-3 col-md-10 col-md-push-2 col-xs-12">
        @include('buz.remit.labatitle')
        <div class="panel panel-default">
            <div class="panel-heading">
                <h4 class="panel-title">
                    历史数据
                </h4>
            </div>
            <div class="panel-body">
                <div class="row">
                    <div class="col-sm-6 lineH28">
                        <div class="form-group">
                            <label for="lastname" class="col-sm-2 control-label padd">提现时间</label>
                            <div class="col-sm-10 padd">
                                <input size="16" type="text"  id="starttime" class="form_datetime form-control" style="width: 49%;">
                                <input size="16" type="text" id="endtime" class="form_datetime form-control" style="width: 49%;">
                            </div>
                        </div>
                    </div>

                    <div class="col-sm-6 lineH28">
                        <div class="form-group">
                            <div class="col-sm-3 padd">
                                <button type="button" class="btn btn-primary" id="search">查询</button>
                            </div>
                            {{--<div class="col-sm-3 padd">--}}
                                {{--<button type="button" class="btn btn-primary" id="daochu">导出</button>--}}
                            {{--</div>--}}
                        </div>
                    </div>
                </div>
                <div class="historyList" id="withdrawList">

                </div>
            </div>
        </div>
    </div>
@endsection()
@section('bottom_js')
    <script src="{{asset('js/buz/template-web.js')}}"></script>
    <script id="list" type="text/html">
        <table class="table table-striped table-bordered">
            <thead>
            <tr>
                <th >平台订单号</th>
                <th >单据金额</th>
                <th >单据状态</th>
                <th >手续费</th>
                <th >实际扣款</th>
                <th >银行开户人名称</th>
                <th >开户银行</th>
                <th >开户账号</th>
                <th >省份</th>
                <th >市区</th>
                <th >地址</th>
                <th >银联号</th>
                <th >备注信息 </th>
                <th >管理员备注</th>
                <th >更新时间</th>
                <th >创建时间</th>
            </tr>
            </thead>
            <tbody>
            @{{each data  value }}
            <tr >
                <td>@{{ value.plat_no }}</td>
                <td>@{{ value.money }}</td>
                @{{ if value.status == 0 }}
                <td class="text-primary">待审核</td>
                @{{ else if value.status == 3  }}
                <td class="text-success">打款成功</td>
                @{{ else if value.status == 6  }}
                <td class="text-warning">打款失败并退回</td>
                @{{ else if value.status == 5  }}
                <td class="text-muted">已撤销</td>
                @{{ else if value.status == 7  }}
                <td class="text-danger">审核未通过</td>
                @{{else}}
                <td class="text-info">处理中</td>
                @{{ /if }}
                <td>@{{ value.fee }}</td>
                <td>@{{ value.ac_money }}</td>
                <td>@{{ value.bk_username }}</td>
                <td>@{{ value.bk_name }}</td>
                <td>@{{ value.bk_account }}</td>
                <td>@{{ value.bk_prov }}</td>
                <td>@{{ value.bk_city }}</td>
                <td>@{{ value.bk_branch }}</td>
                <td>@{{ value.bk_number }}</td>
                <td>@{{ value.remark }}</td>
                <td>@{{ value.ad_remark }}</td>
                <td>@{{ value.updated_at }}</td>
                <td>@{{ value.created_at }}</td>
            </tr>
            @{{ /each }}
            @{{ if data.length <=0 }}
            <tr class="no-records-found"><td colspan="16">没有找到匹配的记录</td></tr>
            @{{ /if }}
            </tbody>
            {{--<tbody>--}}
            {{--<tr>--}}
                {{--<td>本页小计</td>--}}
                {{--<td colspan="13">33333</td>--}}
            {{--</tr>--}}
            {{--<tr>--}}
                {{--<td>合计</td>--}}
                {{--<td colspan="13">33333</td>--}}
            {{--</tr>--}}
            {{--</tbody>--}}
        </table>
        <ul class="pagination">
            @{{ if first_page_url}}
            <li><a href="javascript:;" data-url="@{{ first_page_url }}">首页</a></li>
            @{{ else }}
            <li class="disabled"><a href="javascript:;"  data-url="@{{ first_page_url }}">首页</a></li>
            @{{ /if }}

            @{{ if prev_page_url}}
            <li><a href="javascript:;" data-url="@{{ prev_page_url }}">上一页</a></li>
            @{{ else }}
            <li class="disabled"><a href="javascript:;"  data-url="@{{ prev_page_url }}">上一页</a></li>
            @{{ /if }}

            @{{ if next_page_url}}
            <li><a href="javascript:;" data-url="@{{ next_page_url }}">下一页</a></li>
            @{{ else }}
            <li class="disabled"><a href="javascript:;"  data-url="@{{ next_page_url }}">下一页</a></li>
            @{{ /if }}

            @{{ if last_page_url}}
            <li><a href="javascript:;" data-url="@{{ last_page_url }}">尾页</a></li>
            @{{ else }}
            <li class="disabled" ><a href="javascript:;" data-url="@{{ last_page_url }}">尾页</a></li>
            @{{ /if }}
        </ul>
    </script>
    <script>
        $.ajax({
            url: "/api/order/withdraw",
            type: 'get',
            success:function(data){
                if(filterAjaxData(data)){
                    console.log(data);

                    var html = template('list', data.data);
                    document.getElementById('withdrawList').innerHTML = html;
                }
            }
        });
        //时间
        $(".form_datetime").datetimepicker({
            language: 'zh-CN',
            format: "yyyy-mm-dd hh:ii",
            autoclose: true,
            todayBtn: true,
            minView: 1,
            inline: true
        });
        //查询
        $("#search").click(function(){
            //判断时间
            var starttime=$("#starttime").val();
            var endtime=$("#endtime").val();
            if(starttime==null||endtime==null){
                //setTimeout(function () {
                $('#myModal').modal('show').find(".modal-body").html("时间不能为空");
                //}, 230);
                return false;
            }
            $.ajax({
                url: "/api/order/withdraw",
                type: 'get',
                data:{"start_at":starttime,"end_at":endtime},
                success:function(data){
                    if(filterAjaxData(data)){
                        console.log(data);
                        var html = template('list', data.data);
                        document.getElementById('withdrawList').innerHTML = html;
                    }
                }
            });
        });
        $("#withdrawList").on("click",".pagination li a",function () {
            var _url = $(this).attr("data-url");
            console.log(_url);
            if(_url){
                $.ajax({
                    url: _url,
                    type: 'get',
                    success:function(data){
                        if(filterAjaxData(data)){
                            console.log(data);

                            var html = template('list', data.data);
                            document.getElementById('withdrawList').innerHTML = html;
                        }
                    }
                });
            }else{
                showMsg("没有啦");
            }

        })
    </script>
@endsection()
